<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class CreateOrderRequest extends BaseRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'address_id' => 'required',
            'goods_id' => 'required',
            'num' => 'required|integer|min:1',
        ];
    }

    public function messages()
    {
        return [
            'address_id.required' => '地址ID 不能为空',

            'goods_id.required' => '商品ID 不能为空',

            'num.required' => '购买数据 不能为空',
            'num.integer' => '购买数据 必须是数字',
            'num.min' => '购买数据 最少为 1',
        ];
    }
}
